package com.idopartx.phonelightning.ui.base

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import com.dotools.umlibrary.UMPostUtils
import me.yokeyword.fragmentation.SupportActivity


/**
 * 公共base类
 */
abstract class BaseActivity<DB : ViewDataBinding> : SupportActivity() {

    /**
     * 默认dataBinding
     */
    lateinit var binding: DB

    /**
     * 在这里返回初始化的布局resId
     */
    abstract fun initLayoutResId(): Int


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = DataBindingUtil.setContentView(this, initLayoutResId())
    }


    override fun onDestroy() {
        super.onDestroy()
    }

    override fun onResume() {
        super.onResume()
        UMPostUtils.onActivityResume(this)
    }

    override fun onPause() {
        super.onPause()
        UMPostUtils.onActivityPause(this)
    }
}